const routes = [
  {
    path: '/',
    component: () => import('layouts/MainLayout.vue'),
    children: [
      // 默认重定向到首页
      { path: '', redirect: '/square' },

      // Tab页面路由
      {
        path: '/home',
        name: 'Home',
        component: () => import('pages/tabs/HomePage.vue'),
        meta: {
          keepAlive: true,
          isTab: true,
          tabName: 'home',
        },
      },
      {
        path: '/category',
        name: 'Category',
        component: () => import('pages/tabs/CategoryPage.vue'),
        meta: {
          keepAlive: true,
          isTab: true,
          tabName: 'category',
        },
      },
      {
        path: '/square',
        name: 'Square',
        component: () => import('src/pages/tabs/SquarePage.vue'),
        meta: {
          keepAlive: true,
          isTab: true,
          tabName: 'square',
        },
      },
      {
        path: '/profile',
        name: 'Profile',
        component: () => import('pages/tabs/ProfilePage.vue'),
        meta: {
          keepAlive: true,
          isTab: true,
          tabName: 'profile',
        },
      },
      {
        path: '/message',
        name: 'Message',
        component: () => import('pages/tabs/MessagePage.vue'),
        meta: {
          keepAlive: true,
          isTab: true,
          tabName: 'message',
        },
      },

      // 子页面路由 - 不缓存，无TabBar
      {
        path: '/product/:id',
        name: 'ProductDetail',
        component: () => import('pages/ProductDetail.vue'),
        meta: {
          keepAlive: false,
          isTab: false,
        },
      },
      {
        path: '/thread/:id',
        name: 'threadDetail',
        component: () => import('pages/threadDetail.vue'),
        meta: {
          keepAlive: false,
          isTab: false,
        },
      },
      {
        path: '/chat/:id',
        name: 'ChatDetail',
        component: () => import('pages/ChatDetail.vue'),
        meta: {
          keepAlive: false,
          isTab: false,
        },
      },
      {
        path: '/auth-callback',
        name: 'AuthCallBack',
        component: () => import('pages/Authorize/CallBack.vue'),
        meta: {
          keepAlive: false,
          isTab: false,
        },
      },
      {
        path: '/settings',
        name: 'Settings',
        component: () => import('pages/SettingPage.vue'),
        meta: {
          keepAlive: false,
          isTab: false
        }
      }
    ],
  },

  // 404页面
  {
    path: '/:catchAll(.*)*',
    component: () => import('pages/ErrorNotFound.vue'),
  },
]

export default routes
